package com.jic.product.enums;

import lombok.Getter;

/**
 * Created by Intellij IDEA.
 *
 * @author:  cjw
 * Date:  2020/12/5
 */
@Getter
public enum ProductTypeEnum {
    /**
     * 商品类型枚举
     */
    ROUTINE_PRODUCT(1, "常规商品"),
    CARD_VOUCHER(2, "卡券"),
    BUY_OVERSEAS(3, "海购"),
    GIFT(4, "赠品"),
    PHYSICAL_CARD(10, "实体卡"),
    VIRTUAL_CARD(11, "虚拟卡"),
    COUPON(20, "券"),
    FRESH_PRODUCT(5, "生鲜产品"),
    VALUE_ADDED_SERVICES(6, "增值服务"),
    OTHER(7, "其他"),
    INTEGRAL_PRODUCT(21, "积分商品"),
    WEIGH_PRODUCT(31, "称重商品"),
    ;

    private Integer code;

    private String message;

    ProductTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static ProductTypeEnum getByCode(Integer code){
        ProductTypeEnum[] values = ProductTypeEnum.values();
        for(ProductTypeEnum value : values){
            if(value.getCode().equals(code)){
                return value;
            }
        }
        return null;
    }
}
